O(1) Reversible Tree Navigation Without Cycles
نویسنده
چکیده
Imperative programmers often use cyclically linked trees in order to achieve O(1) navigation time to neighbours. Some logic programmers believe that cyclic terms are necessary to achieve the same in logic-based languages. An old but little-known technique provides O(1) time and space navigation without cyclic links, in the form of reversible predicates. A small modification provides O(1) amortised time and space editing. 1 The problem When imperative programmers think of lists, they commonly choose doubly linked lists, instead of the singly linked lists that logic and functional programmers use. In the same way, it is extremely common for trees to be given parent links, whether they are really needed or not. A typical C example might be typedef int Datum; typedef struct TreeRec *TreePtr; struct TreeRec { TreePtr left, right, up, down; Datum datum; }; where ‘down’ points to the first child of a node, ‘up’ to its parents, and the children of a node form a doubly linked list with ‘left’ and ‘right’ pointers. Essentially this representation is required by the Document Object Model (W3C, 1998; W3C, 2000), for example. Cyclically linked trees in imperative languages such as Java provide constant time navigation in any of the four directions (up, down, left, right) and also constant time and constant space editing (insert, delete, replace). They do so at a price: each element is rigidly locked into place, so that any kind of space sharing (such as hash consing) is made impossible. Some logic programming languages have been designed to support cyclically linked terms. That does provide constant time navigation, but not editing. The locking into place that is a nuisance in imperative languages is a very serious difficulty
منابع مشابه
Bifurcation of limit cycles from a quadratic reversible center with the unbounded elliptic separatrix
The paper is concerned with the bifurcation of limit cycles in general quadratic perturbations of a quadratic reversible and non-Hamiltonian system, whose period annulus is bounded by an elliptic separatrix related to a singularity at infinity in the poincar'{e} disk. Attention goes to the number of limit cycles produced by the period annulus under perturbations. By using the appropriate Picard...
متن کاملCst++
Let A be an array of n elements taken from a totally ordered set. We present a data structure of size 3n+ o(n) bits that allows us to answer the following queries on A in constant time, without accessing A: (1) given indices i < j, find the position of the minimum in A[i..j], (2) given index i, find the first index to the left of i where A is strictly smaller than at i, and (3) same as (2), but...
متن کاملSelf-similarity of period-doubling branching in 3-D reversible mappings
We consider 3-dimensional (3-D) mappings which are reversible, i.e. possess a time-reversal symmetry. In the mappings studied here, the reversibility is such that it guarantees the existence of one-parameter families (curves) of symmetric periodic orbits in the phase space. It is found that such curves can often intersect one another. In particular, a curve of n-cycles can intersect a curve of ...
متن کاملO-23: Hysteroscopic Polypectomy without Cycle Cancellation in IVF/ICSI Cycles: A Matched Case-Control Study
Background The effect of hysteroscopic polpectomy for endometrial polyps during treatment cycles is still debated and further studies are necessary to evaluate beneficial effect of this procedure. MaterialsAndMethods This matched case-control study compared retrospectively 86 women with and without hysteroscopic polypectomy who underwent in vitro fertilization and / or Intracytoplasmic sperm in...
متن کاملData in the Cloud: Authentication of Trees, Graphs, and Forests Without Leaking
In this paper, we address the problem of how to authenticate sub-trees (sub-graphs) without leakage of information. Previous schemes for tree (graph)-organized data, such as XML documents, authenticate information recorded in tree (graph) nodes, but leak structural information that the data receiver is not entitled to access. This is often unacceptable, as the value of a tree (graph)organized d...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- CoRR
دوره cs.PL/0406014 شماره
صفحات -
تاریخ انتشار 2004